Jsonformatter I understand that ASP NET Web API natively uses Json NET for de serializing objects but is there a way to specify a JsonSerializerSettings object that you want for it to use For example
I have a Web API project that returns some product data It negotiates the return type correctly depending on the Accept header JSON XML of the request The problem is if no Accept Looking for a function that will take a string of Json as input and format it with line breaks and indentations Validation would be a bonus but isn t necessary and I don t need to parse it into an
Jsonformatter
Jsonformatter
[img_title-2]
[img_title-3]
I m using Serlog 2 10 Writing to Console as human readable text and to RollingFile with JsonFormatter I want in the output JSON to have both Message and MessageTemplate This uses the JsonFormatter from the Google Protobuf library The problem all json content is stored in one line when file is quite big 50 MB it is hard to open view in text editor
You re correct about where to set the serializer However that serializer is used when the request to your site is made with a requested content type of JSON It isn t part of the settings used when While the logging Formatter takes a string which it interpolates to output the formatted log record the JsonFormatter takes a dictionary where the key will be the key of the logged value in the
More picture related to Jsonformatter
[img_title-4]
[img_title-5]
[img_title-6]
By the way with the Serilog Formatting Json JsonFormatter your log files will end with line by line Json Format data which you can easily ingest using another C project and load all the I configure the output format in appsettings json but it does not work quot Serilog quot quot WriteTo quot quot Name quot quot Console quot
[desc-10] [desc-11]
[img_title-7]
[img_title-8]
https://stackoverflow.com › questions
I understand that ASP NET Web API natively uses Json NET for de serializing objects but is there a way to specify a JsonSerializerSettings object that you want for it to use For example
https://stackoverflow.com › questions
I have a Web API project that returns some product data It negotiates the return type correctly depending on the Accept header JSON XML of the request The problem is if no Accept
[img_title-9]
[img_title-7]
[img_title-10]
[img_title-11]
[img_title-12]
[img_title-13]
[img_title-13]
[img_title-14]
[img_title-15]
[img_title-16]
Jsonformatter - This uses the JsonFormatter from the Google Protobuf library The problem all json content is stored in one line when file is quite big 50 MB it is hard to open view in text editor